home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / ipc / mainmsgqcli.c < prev    next >
C/C++ Source or Header  |  1989-12-17  |  627b  |  30 lines

  1. #include    "msgq.h"
  2.  
  3. main()
  4. {
  5.     int    readid, writeid;
  6.  
  7.     /*
  8.      * Open the message queues.  The server must have
  9.      * already created them.
  10.      */
  11.  
  12.     if ( (writeid = msgget(MKEY1, 0)) < 0)
  13.         err_sys("client: can't msgget message queue 1");
  14.     if ( (readid = msgget(MKEY2, 0)) < 0)
  15.         err_sys("client: can't msgget message queue 2");
  16.  
  17.     client(readid, writeid);
  18.  
  19.     /*
  20.      * Now we can delete the message queues.
  21.      */
  22.  
  23.     if (msgctl(readid, IPC_RMID, (struct msqid_ds *) 0) < 0)
  24.         err_sys("client: can't RMID message queue 1");
  25.     if (msgctl(writeid, IPC_RMID, (struct msqid_ds *) 0) < 0)
  26.         err_sys("client: can't RMID message queue 2");
  27.  
  28.     exit(0);
  29. }
  30.